From: Florian Müllner Date: Sat, 23 Feb 2013 00:37:05 +0000 (+0100) Subject: scroll-view-fade: Tweak easing at edges X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~4616 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b394d184cc7fa68924da7e4c57ba9d2eb84c97ef;p=gnome-shell.git scroll-view-fade: Tweak easing at edges Since commit b4f5f1e46174, the effect is eased in at the scroll view's edges so that it does not appear out of nowhere. However, the linear easing used is not the best option, as now the effect appears so late that content near the edges ends up just being cut off rather than faded out. So adjust the easing function to have the effect appear faster. https://bugzilla.gnome.org/show_bug.cgi?id=694327 --- diff --git a/src/st/st-scroll-view-fade.glsl b/src/st/st-scroll-view-fade.glsl index 6acd26000..e8bd03a2a 100644 --- a/src/st/st-scroll-view-fade.glsl +++ b/src/st/st-scroll-view-fade.glsl @@ -64,20 +64,20 @@ void main () float vfade_scale = height / vfade_offset; if (fade_top) { - ratio *= FADE((y / vfade_offset), min(vvalue * vfade_scale, 1.0)); + ratio *= FADE((y / vfade_offset), min(sqrt(vvalue) * vfade_scale, 1.0)); } if (fade_bottom) { - ratio *= FADE((fade_area[1][1] - y)/(fade_area[1][1] - fade_bottom_start), min((1.0 - vvalue) * vfade_scale, 1.0)); + ratio *= FADE((fade_area[1][1] - y)/(fade_area[1][1] - fade_bottom_start), min(sqrt(1.0 - vvalue) * vfade_scale, 1.0)); } float hfade_scale = width / hfade_offset; if (fade_left) { - ratio *= FADE(x / hfade_offset, min(hvalue * hfade_scale, 1.0)); + ratio *= FADE(x / hfade_offset, min(sqrt(hvalue) * hfade_scale, 1.0)); } if (fade_right) { - ratio *= FADE((fade_area[1][0] - x)/(fade_area[1][0] - fade_right_start), min((1.0 - hvalue) * hfade_scale, 1.0)); + ratio *= FADE((fade_area[1][0] - x)/(fade_area[1][0] - fade_right_start), min(sqrt(1.0 - hvalue) * hfade_scale, 1.0)); } cogl_color_out *= ratio;